package StartGame;

import java.util.ArrayList;
import java.util.List;
import org.newdawn.slick.geom.Rectangle;



public class BuildMenue {
	
	private List<MenueItem> menueItems = new ArrayList<MenueItem>();
	private Ingame ingame;
	private Rectangle menueRect;
	private MenueItem selectedItem;
	
	public BuildMenue(Ingame ingame) {
		this.ingame = ingame;
	}
	
	public void init() {
		menueRect = new Rectangle(ingame.getScreenRect().getWidth()+50, 0, 200, ingame.getScreenRect().getHeight());
		addMenueItem(new MenueItem(ingame.getGame().getResourceManager().getImage("BUILDMENUE_BASE"), (int)menueRect.getMinX(), 0, "BUILDING_BASE", 300.0));
	}
	
	private void addMenueItem(MenueItem menueItem) {
		menueItems.add(menueItem);
	}

	public void render() {
		for(MenueItem item: menueItems) {
				item.getImage().draw(item.getX(), item.getY());
		}
	}
	
	public Rectangle getBuildMenueRect() {
		return menueRect;
	}

	public void mouseReleased(int button, int x, int y) {
		for(MenueItem item: menueItems) {
			if(item.getItemRect().contains(x, y)) {
				selectedItem = item;
				return;
			}
		}
	}
	
	public MenueItem getSelecteditem() {
		return selectedItem;
	}
	
}
